<template>
  <div>
    <basic-table
      :table-title="tableTitle"
      :data-source="dataSource"
      :data-params="dataParams"
      :multiple-table="false"
      class="mt-4"
    >
      <template v-slot:chack="scope">
        <span style="color: #0087FE; cursor: pointer;" @click="changeStatus(scope.row)">
          查看
        </span>
      </template>
    </basic-table>

    <Modal
      :show="dialogVisible"
      :descriptions-info="descInfo"
      :descriptions-list="descriptionsList"
      @close="close"
    />
  </div>
</template>
<script>
import BasicTable from '@/components/BasicTable/index.vue'
import Modal from '@/components/Modal/Index'

import { getViolationForcesDetail, getViolationForces } from '@/api/project'

export default {
  name: 'BasicInfos',
  components: { BasicTable, Modal },
  props: {
    projectId: { type: String, default: '' }
  },
  data() {
    return {
      dialogVisible: false,
      dataSource: () => getViolationForces,
      dataParams: {},
      tableTitle: [
        {
          label: '施工图审查合格书编号',
          value: 'CensorNum',
          show: true,
          type: 'text'
        },
        {
          label: '违反强制性标准情况编号',
          value: 'ViolationNormNum',
          show: true,
          type: 'text'
        },
        {
          label: '审查专业',
          value: 'CensorMajor',
          show: true,
          type: 'text'
        },
        {
          label: '强制性标准涉及人员',
          value: 'InvolvePerName',
          show: true,
          type: 'text'
        },
        {
          label: '强制性标准涉及单位名称',
          value: 'InvolveComName',
          show: true,
          type: 'text'
        },
        {
          label: '详情',
          show: true,
          type: 'slot',
          slot: 'chack'
        }
      ],
      descriptionsList: {
        'CensorNum': '施工图审查合格书编号',
        'DesignErrNum': '违反强制性标准情况编号',
        'CensorMajor': '审查专业',
        'DesignErrType': '违反强制性标准类型',
        'ErrPerName': '强制性标准涉及人员',
        'ErrPerIdcard': '强制性标准涉及人员身份证',
        'ErrComName': '强制性标准涉及单位名称',
        'ErrComNum': '所属单位统一社会信用代码',
        'Createdate': '记录登记时间',
        'ErrDealWith': '违反强制性标准处理情况',
        'ErrModify': '违反强制性标准整改情况',
        'ErrInfluence': '违反强制性标准造成后果'
      },
      descInfo: null
    }
  },
  created() {
    this.dataParams.projectId = this.projectId
  },
  methods: {
    close(v) {
      this.dialogVisible = v
    },
    changeStatus(v) {
      getViolationForcesDetail({
        id: v.Id,
        projectId: this.projectId
      }).then(res => {
        if (res.code === 200) {
          this.dialogVisible = true
          this.descInfo = res.data.detail
        }
      })
    }
  }
}
</script>

<style scoped>

</style>
